package com.yh.csx.event.store.mapstruct;

import com.google.inject.internal.cglib.core.$DuplicatesPredicate;
import com.yh.csx.event.domain.DataStatusEnum;
import com.yh.csx.event.domain.DelFlagEnum;
import com.yh.csx.event.store.event.dto.resp.AckEventResp;
import com.yh.csx.event.store.event.dto.resp.ErrorEventResp;
import com.yh.csx.event.store.gateway.event.dataobject.BizEventDo;
import com.yh.csx.event.store.gateway.event.dataobject.BizEventResultDo;
import com.yh.csx.event.store.gateway.event.dataobject.EventTypeDo;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;

import java.util.Date;

/**
 * @author zhangsheng
 * @date 2021/8/23 16:55
 */
@Mapper(componentModel = "spring")
public interface EventTypeMapStruct {
    EventTypeMapStruct INSTANCE = Mappers.getMapper(EventTypeMapStruct.class);

    EventTypeDo convert(BizEventDo resp);

    default EventTypeDo config(BizEventDo resp) {
        EventTypeDo convert = convert(resp);
        convert.setDelFlag(DelFlagEnum.NORMAL.getCode());
        convert.setStatus(DataStatusEnum.NORMAL.getCode());
        convert.setCreator("sys");
        convert.setUpdater("sys");
        convert.setEventName("sys");
        convert.setCreateTime(new Date());
        return convert;
    }


}
